package by.yakusekmaxim.bookgid.webapp.page.admin.image;

import javax.inject.Inject;

import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;

import by.yakusekmaxim.bookgid.datamodel.Image;
import by.yakusekmaxim.bookgid.services.ImageService;
import by.yakusekmaxim.bookgid.webapp.page.AdminLayout;

public class ImagePage extends AdminLayout {

	@Inject
	private ImageService imageService;

	protected void onInitialize() {
		super.onInitialize();
		
		add(new Link<Object>("linkEditImagePage") {
			@Override
			public void onClick() {
				setResponsePage(new EditImagePage(new Image()));
			}
		});
		
		add(new Label("count", imageService.getCount()));
		add(new ImageListPanel("imageList"));
	}

	@Override
	protected WebMarkupContainer getTarget() {
		return targetImage;
	}
}
